package summer_vacation.shuqiqi.java;

import java.util.Scanner;

/**
 * Created by shuqi on 2015/8/14.
 */
public class Assignment_20 {
    public static void main(String[] args){
        Scanner cin=new Scanner(System.in );
        String Str=cin.nextLine();
        int m=0,n=0;
        for(int i=0;i<Str.length();i++){
            char c=Str.charAt(i);
            if(c>'a'&&c<'z')
                n++;
                else m++;
                }
                if(n>m){
                    System.out.println(n);
                } else
                    System.out.println(m);

            }
        }

